using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;

namespace Adex
{
    /// <summary>
    /// Controller class for OutdoorLog
    /// </summary>
    [System.ComponentModel.DataObject]
    public partial class OutdoorLogController
    {
        // Preload our schema..
        OutdoorLog thisSchemaLoad = new OutdoorLog();
        private string userName = string.Empty;
        protected string UserName
        {
            get
            {
				if (userName.Length == 0) 
				{
    				if (System.Web.HttpContext.Current != null)
    				{
						userName=System.Web.HttpContext.Current.User.Identity.Name;
					}

					else
					{
						userName=System.Threading.Thread.CurrentPrincipal.Identity.Name;
					}

				}

				return userName;
            }

        }

        [DataObjectMethod(DataObjectMethodType.Select, true)]
        public OutdoorLogCollection FetchAll()
        {
            OutdoorLogCollection coll = new OutdoorLogCollection();
            Query qry = new Query(OutdoorLog.Schema);
            coll.LoadAndCloseReader(qry.ExecuteReader());
            return coll;
        }

        [DataObjectMethod(DataObjectMethodType.Select, false)]
        public OutdoorLogCollection FetchByID(object OutdoorLogID)
        {
            OutdoorLogCollection coll = new OutdoorLogCollection().Where("OutdoorLogID", OutdoorLogID).Load();
            return coll;
        }

		
		[DataObjectMethod(DataObjectMethodType.Select, false)]
        public OutdoorLogCollection FetchByQuery(Query qry)
        {
            OutdoorLogCollection coll = new OutdoorLogCollection();
            coll.LoadAndCloseReader(qry.ExecuteReader()); 
            return coll;
        }

        [DataObjectMethod(DataObjectMethodType.Delete, true)]
        public bool Delete(object OutdoorLogID)
        {
            return (OutdoorLog.Delete(OutdoorLogID) == 1);
        }

        [DataObjectMethod(DataObjectMethodType.Delete, false)]
        public bool Destroy(object OutdoorLogID)
        {
            return (OutdoorLog.Destroy(OutdoorLogID) == 1);
        }

        
        
    	
	    /// <summary>
	    /// Inserts a record, can be used with the Object Data Source
	    /// </summary>
        [DataObjectMethod(DataObjectMethodType.Insert, true)]
	    public void Insert(byte? CountryID,DateTime? RFDate,int? MediaCode,int? TimeStart,int? TimeEnd,string TimeStartFormatted,string TimeEndFormatted,int? Size,string Quality,decimal? RealCost,string LatLong,int? NoOfAds,int? TotalAdsInThatLocation,int? TypeOfAds,int? VisibilityCode,DateTime? VerificationDate,string VerificationDesc,int? CarrierCode,int? ProdVersionID,int? ProductID,int? CategoryID,int? SubSectorID,int? SectorID,int? BrandID,int? AdvertiserID,int? AgencyID,string BetweenAvenue,int? PhotoCode,DateTime DateAdded,DateTime DateModified)
	    {
		    OutdoorLog item = new OutdoorLog();
		    
            item.CountryID = CountryID;
            
            item.RFDate = RFDate;
            
            item.MediaCode = MediaCode;
            
            item.TimeStart = TimeStart;
            
            item.TimeEnd = TimeEnd;
            
            item.TimeStartFormatted = TimeStartFormatted;
            
            item.TimeEndFormatted = TimeEndFormatted;
            
            item.Size = Size;
            
            item.Quality = Quality;
            
            item.RealCost = RealCost;
            
            item.LatLong = LatLong;
            
            item.NoOfAds = NoOfAds;
            
            item.TotalAdsInThatLocation = TotalAdsInThatLocation;
            
            item.TypeOfAds = TypeOfAds;
            
            item.VisibilityCode = VisibilityCode;
            
            item.VerificationDate = VerificationDate;
            
            item.VerificationDesc = VerificationDesc;
            
            item.CarrierCode = CarrierCode;
            
            item.ProdVersionID = ProdVersionID;
            
            item.ProductID = ProductID;
            
            item.CategoryID = CategoryID;
            
            item.SubSectorID = SubSectorID;
            
            item.SectorID = SectorID;
            
            item.BrandID = BrandID;
            
            item.AdvertiserID = AdvertiserID;
            
            item.AgencyID = AgencyID;
            
            item.BetweenAvenue = BetweenAvenue;
            
            item.PhotoCode = PhotoCode;
            
            item.DateAdded = DateAdded;
            
            item.DateModified = DateModified;
            
	    
		    item.Save(UserName);
	    }

    	
	    /// <summary>
	    /// Updates a record, can be used with the Object Data Source
	    /// </summary>
        [DataObjectMethod(DataObjectMethodType.Update, true)]
	    public void Update(int OutdoorLogID,byte? CountryID,DateTime? RFDate,int? MediaCode,int? TimeStart,int? TimeEnd,string TimeStartFormatted,string TimeEndFormatted,int? Size,string Quality,decimal? RealCost,string LatLong,int? NoOfAds,int? TotalAdsInThatLocation,int? TypeOfAds,int? VisibilityCode,DateTime? VerificationDate,string VerificationDesc,int? CarrierCode,int? ProdVersionID,int? ProductID,int? CategoryID,int? SubSectorID,int? SectorID,int? BrandID,int? AdvertiserID,int? AgencyID,string BetweenAvenue,int? PhotoCode,DateTime DateAdded,DateTime DateModified)
	    {
		    OutdoorLog item = new OutdoorLog();
		    
				item.OutdoorLogID = OutdoorLogID;
				
				item.CountryID = CountryID;
				
				item.RFDate = RFDate;
				
				item.MediaCode = MediaCode;
				
				item.TimeStart = TimeStart;
				
				item.TimeEnd = TimeEnd;
				
				item.TimeStartFormatted = TimeStartFormatted;
				
				item.TimeEndFormatted = TimeEndFormatted;
				
				item.Size = Size;
				
				item.Quality = Quality;
				
				item.RealCost = RealCost;
				
				item.LatLong = LatLong;
				
				item.NoOfAds = NoOfAds;
				
				item.TotalAdsInThatLocation = TotalAdsInThatLocation;
				
				item.TypeOfAds = TypeOfAds;
				
				item.VisibilityCode = VisibilityCode;
				
				item.VerificationDate = VerificationDate;
				
				item.VerificationDesc = VerificationDesc;
				
				item.CarrierCode = CarrierCode;
				
				item.ProdVersionID = ProdVersionID;
				
				item.ProductID = ProductID;
				
				item.CategoryID = CategoryID;
				
				item.SubSectorID = SubSectorID;
				
				item.SectorID = SectorID;
				
				item.BrandID = BrandID;
				
				item.AdvertiserID = AdvertiserID;
				
				item.AgencyID = AgencyID;
				
				item.BetweenAvenue = BetweenAvenue;
				
				item.PhotoCode = PhotoCode;
				
				item.DateAdded = DateAdded;
				
				item.DateModified = DateModified;
				
		    item.MarkOld();
		    item.Save(UserName);
	    }

    }

}

